package com.example.travelapplication.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.travelapplication.R;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link FragmentOpen#newInstance} factory method to
 * create an instance of this fragment.
 */
public class FragmentOpen extends Fragment {

    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;

    public FragmentOpen() {
        // Required empty public constructor
    }

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param param1 Parameter 1.
     * @param param2 Parameter 2.
     * @return A new instance of fragment FragmentOpen.
     */
    // TODO: Rename and change types and number of parameters
    public static FragmentOpen newInstance(String param1, String param2) {
        FragmentOpen fragment = new FragmentOpen();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    TextView textView;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_open, container, false);

        String appName = getResources().getString(R.string.app_name);
        String content =  "《" + appName + "》" + "使用如下依赖：\n" +
                "==============================\n" +
                "'androidx.appcompat:appcompat:1.4.1'\n" +
                "'com.google.android.material:material:1.1.0'\n" +
                "'androidx.constraintlayout:constraintlayout:2.1.3'\n" +
                "'androidx.legacy:legacy-support-v4:1.0.0'\n" +
                "'junit:junit:4.13.2'\n" +
                "'androidx.test.ext:junit:1.1.3'\n" +
                "'androidx.test.espresso:espresso-core:3.4.0'\n" +
                "'com.github.bumptech.glide:glide:4.12.0'\n" +
                "'androidx.room:room-compiler:2.4.2'\n" +
                "'androidx.room:room-runtime:2.4.2'\n" +
                "'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'\n\n"+
                "《" + appName + "》" + "包含如下开源组件：\n" +
                "==============================\n" +
                "TextView\n" +
                "ImageView\n" +
                "Button\n" +
                "ImageButton\n" +
                "Toolbar\n" +
                "CardView\n" +
                "SearchView\n" +
                "ListView\n" +
                "ScrollView\n" +
                "ConstraintLayout\n" +
                "LinearLayout\n" +
                "RelativeLayout\n" +
                "FrameLayout\n" +
                "NestedScrollableHost\n" +
                "SwipeRefreshLayout\n" +
                "CoordinatorLayout\n" +
                "RecyclerView\n" +
                "ViewPager2\n" +
                "BottomAppBar\n" +
                "FloatingActionButton\n";
        textView = view.findViewById(R.id.tv_open_content);
        textView.setText(content);

        return view;
    }
}